home *** CD-ROM | disk | FTP | other *** search
- #
- # get the order from the user
- # get order title
- $TITLE="Catalog Maker Get Order";
- ###############################
- # END OF CHANGEABLE OPTIONS #
- ###############################
-
- # START MAIN PROGRAM
- # ------------------
-
- &ReadParse;
- $Session = $in{'SessionID'};
- if ($Session eq '') {&PrintError; exit 1;} # An Error
- elsif ($Session eq '*SeSiOnId*') {&PrintError; exit 1;}; # Get a session id
- print "Content-Type: text/html\n\n";
- $targetFile = $ENV{'PATH_TRANSLATED'};
- $CatTitle = $in{'CatTitle'};
- $CGIPath = $in{'CGIPath'};
- print (&ReplaceInfo($targetFile));
- &GetShipping; # created by CatMake
- &GetPayment; # created by CatMake
- &ActivationAndInfo;
-
- exit(1);
-
- # GENERAL SUBROUTINES
- # -------------------
-
- sub ReadParse {
- local (*in) = @_ if @_; local ($i, $loc, $key, $val);
- if ($ENV{'REQUEST_METHOD'} eq "GET") { $in = $ENV{'QUERY_STRING'}; }
- elsif ($ENV{'REQUEST_METHOD'} eq "POST") { read(STDIN,$in,$ENV{'CONTENT_LENGTH'}); }
- @in = split(/&/,$in);
- foreach $i (0 .. $#in) {
- $in[$i] =~ s/\+/ /g;
- ($key, $val) = split(/=/,$in[$i],2); # splits on the first =.
- $key =~ s/%(..)/pack("c",hex($1))/ge;
- $val =~ s/%(..)/pack("c",hex($1))/ge;
- $in{$key} .= "\0" if (defined($in{$key})); # \0 is the multiple separator
- $in{$key} .= $val;
- }
- return 1; # just for fun
- } # ReadParse
-
- sub PrintError {
- print("Content-Type: text/html\n\n");
- print <<EOF;
- <HTML>
- <HEAD><TITLE>ERROR</TITLE></HEAD>
- <BODY>
- <H1 ALIGN=CENTER>$TITLE</H1> <HR>
- An error occured in the script!
- <HR>
- EOF
- } # PrintError
-
- sub ReplaceInfo {
- local($fileName) = @_;
-
- open(INPUT, "<$fileName") || "Error opening order template.\n";
- undef $/; # Read in the entire file
- ($data = <INPUT>) || "Error reading order template file.\n";
-
- $data =~ s/\*SeSiOnId\*/$Session/g;
- $data =~ s/\*CatTitle\*/$CatTitle/g;
- $data =~ s/\*CGIPath\*/$CGIPath/g;
-
- $data;
- } # ReplaceInfo
-
- sub ActivationAndInfo {
- print "<br><b><Additional Payment Information></b><table border>";
- print "<tr><th>Card/Purchase Order # </th><td><input type=\"TEXT\" name=\"CARDNUM\" size=40></td></tr>";
- print "<tr><th>Name on Card</th><td><input type=\"TEXT\" name=\"NAMEONCARD\" size=40></td></tr>";
- print "<tr><th>Expiration date</th><td><input type=\"TEXT\" name=\"EXPRDATE\" size=40></td></tr></table>";
-
- print "<br><b>Comments</b><br>";
- print "<textarea rows=4 cols=40 name=\"COMMENTS\"></TEXTAREA>";
-
- print "<br><input type=\"SUBMIT\" value=\"Submit\"><input type=\"RESET\" value=\"Reset\"></form>";
- } # ActivationAndInfo
-
-
-
-